package com.hanqi.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.hanqi.model.WmUsers;
import com.hanqi.service.UserService;
import com.opensymphony.xwork2.ModelDriven;

@Repository
public class UserAction extends BaseAction implements ModelDriven<WmUsers> {

	private static final long serialVersionUID = 1L;

	@Autowired
	private UserService userService;

	private WmUsers wmUsers;

	public String register() {
		try {
			userService.save(wmUsers);
		} catch (Exception e) {
			e.printStackTrace();
			return ERROR;
		}
		return SUCCESS;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public WmUsers getWmUsers() {
		return wmUsers;
	}

	public void setWmUsers(WmUsers wmUsers) {
		this.wmUsers = wmUsers;
	}

	public WmUsers getModel() {
		if (wmUsers == null) {
			wmUsers = new WmUsers();
		}
		return wmUsers;
	}

}
